local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then return end

vim.g.nvim_tree_gitignore = 1
vim.g.nvim_tree_auto_ignore_ft = {'startify', 'dashboard'}
-- vim.g.nvim_tree_quit_on_open = 1
vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_git_hl = 1
vim.g.nvim_tree_highlight_opened_files = 1
vim.g.nvim_tree_ignore = {'.git', 'node_modules', '.cache'}
vim.g.nvim_tree_icons = {
    default = '',
    symlink = '',
    git = {
        unstaged = "",
        staged = "S",
        unmerged = "",
        renamed = "➜",
        deleted = "",
        untracked = "U",
        ignored = "◌"
    },
    folder = {
        default = "",
        open = "",
        empty = "",
        empty_open = "",
        symlink = ""
    }
}

local tree_cb = require'nvim-tree.config'.nvim_tree_callback

local list = {
    {key = "l", cb = tree_cb("edit")}, {key = "h", cb = tree_cb("close_node")},
    {key = "<Tab>", cb = tree_cb("edit")}
}

nvim_tree.setup({
    disable_netrw = true,
    hijack_netrw = true,
    open_on_setup = false,
    ignore_ft_on_setup = {},
    auto_close = false,
    open_on_tab = false,
    update_to_buf_dir = {enable = true, auto_open = true},
    hijack_cursor = false,
    update_cwd = false,
    diagnostics = {
        enable = true,
        icons = {hint = "", info = "", warning = "", error = ""}
    },
    update_focused_file = {enable = true, update_cwd = false, ignore_list = {}},
    system_open = {cmd = nil, args = {}},

    view = {
        width = 35,
        height = 30,
        side = 'left',
        auto_resize = true,
        mappings = {custom_only = false, list = list}
    }
})

